package com.learn.springcloud.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * Hello world!
 *
 *1，@EnableDiscoveryClient注解是基于spring-cloud-commons依赖，并且在classpath中实现； 
  2，@EnableEurekaClient注解是基于spring-cloud-netflix依赖，只能为eureka作用；
     如果你的classpath中添加了eureka，则它们的作用是一样的。
 */
@SpringBootApplication
//让服务使用eureka服务器
@EnableEurekaClient   //基于
//@EnableDiscoveryClient 
public class WebApplication {
	
	private static final Logger logger=LoggerFactory.getLogger(WebApplication.class);
	
    public static void main( String[] args )
    {
    	SpringApplication.run(WebApplication.class, args);
		logger.info("SpringBoot Start Success");
    }
    
    @LoadBalanced
    @Bean
	RestTemplate restTemplate() {
		return new RestTemplate();
	}

}
